#include <iostream>
using namespace std;

int main()
{
	int age = 30;
	const double Pi = 3.1416;

	// 使用&在内存中查找地址
	cout << &age << endl;
	cout << &Pi << endl;
	//
	int* pointsToInt = &age;
	// 将输入存储在由pointsToAnAge指向的内存中
	// cin >> *pointsToInt;

	// 显示指针值
	cout << "Integer age is at: 0x" << pointsToInt << endl;
	cout << "*pointsToInt = " << *pointsToInt << endl;//30
	//
	int dogsAge = 9;
	pointsToInt = &dogsAge;
	cout << "pointsToInt = 0x" << pointsToInt << endl;//
	cout << "*pointsToInt = " << *pointsToInt << endl;//9
    //
    cout << "sizeof(char) = " << sizeof(char) << endl;//1
	cout << "sizeof(int) = " << sizeof(int) << endl;//4
	cout << "sizeof(double) = " << sizeof(double) << endl;//8
	//
	cout << "sizeof(char*) = " << sizeof(char*) << endl;;//8
	cout << "sizeof(int*) = " << sizeof(int*) << endl;;//8
	cout << "sizeof(double*) = " << sizeof(double*) << endl;;//8
    //
    // 请求int的内存空间
    int* pointsToAnAge = new int;
    // 使用分配的内存存储一个数字
    *pointsToAnAge = 5;
    // 使用间接运算符*访问值
    cout << hex  << *pointsToAnAge << endl;
    cout << pointsToAnAge << endl;
    delete pointsToAnAge; // 释放内存
    //

	return 0;
}